Count occurrences of a substringΒΆ
S.count(word)
Count occurrences of a substring in a string.
S = 'The quick brown fox jumps over the lazy dog.'
print(S.count("fox")) # 1
S.count(word)
S = 'The quick brown fox jumps over the lazy dog.'
print(S.count("fox")) # 1